<template>
    <div>

      <div id="app">
        <el-container style="border: 1px solid #eee">
          <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
            <el-menu router :default-openeds="['1', '3']" :default-active="'1'">
              <el-submenu index="1">
                <template slot="title"><i class="el-icon-message"></i>航班管理</template>
                <el-menu-item index="/manager/insertFlight" >
                  新建航班
                </el-menu-item>
                <el-menu-item index="/manager/queryFlight">
                  航班查询
                </el-menu-item>
                <el-menu-item index="/manager/summaryFlight">
                  航班统计
                </el-menu-item>
              </el-submenu>
              <el-submenu index="2">
                <template slot="title"><i class="el-icon-message"></i>机票管理</template>
                <el-menu-item index="/manager/ticketManage">
                  机票查询
                </el-menu-item>
              </el-submenu>
              <el-submenu index="3">
                <template slot="title"><i class="el-icon-message"></i>用户管理</template>
                <el-menu-item index="/manager/queryUser">
                  用户查询
                </el-menu-item>
              </el-submenu>
            </el-menu>
          </el-aside>

          <el-container>
            <el-header style="background-color: slategray;padding:10px">
              <div style="float:left;">
                <el-button @click="backToIndex" type="primary" plain
                           round >返回首页</el-button>
              </div>
              <div style="margin-right: 100px;float:right;margin:10px;">
                <el-dropdown >
                  <i class="el-icon-setting" ></i>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item @click.native="change">切换管理员</el-dropdown-item>
                    <el-dropdown-item @click.native="logOut">退出登录</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>&nbsp;
                <span >{{manager.userName}}</span>
              </div>







            </el-header>

            <el-main>
              <router-view></router-view>
            </el-main>
          </el-container>
        </el-container>


      </div>


    </div>

</template>

<script>
export default {
  data(){
    return{
      manager:{},
      isLogin:true
    }
  },
  methods: {
      change(){
        this.$router.replace('/managerLogin')
      },
      backToIndex(){
        this.$router.replace('/IndexPage');
      },
      logOut(){
        sessionStorage.removeItem('manager')
        this.$router.replace('/IndexPage')
      }
  },
  mounted(){
    this.manager=JSON.parse(sessionStorage.getItem('manager'))
    if(this.manager==null){
      this.isLogin=false
    }
  }
}
</script>

<style>

</style>
